# Maintainer: Jan de Groot <jgc@archlinux.org>
# Contributor: Michal Krenek <mikos@sg1.cz>

pkgname=ttf-dejavu
pkgver=2.37+18+g9b5d1b2f
pkgrel=3
pkgdesc="Font family based on the Bitstream Vera Fonts with a wider range of characters"
arch=('any')
url="https://dejavu-fonts.github.io/"
license=('custom')
makedepends=('git' 'fontforge' 'perl-font-ttf')
provides=('ttf-font')
_commit=9b5d1b2ffeec20c7b46aa89c0223d783c02762cf  # master
source=("git+https://github.com/dejavu-fonts/dejavu-fonts.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd dejavu-fonts
  git describe --tags | sed 's/^version_//;s/_/./;s/-/+/g'
}

build() {
  cd dejavu-fonts
  make full-ttf
}

package() {
  cd dejavu-fonts
  install -Dt "$pkgdir/usr/share/fonts/TTF" -m644 build/*.ttf
  install -Dt "$pkgdir/usr/share/fontconfig/conf.avail" -m644 fontconfig/*.conf

  mkdir "$pkgdir/usr/share/fontconfig/conf.default"
  ln -srt "$pkgdir/usr/share/fontconfig/conf.default" \
    "$pkgdir"/usr/share/fontconfig/conf.avail/*

  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 LICENSE
}
